package com.platform.destiny.utils;


import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;

import javax.servlet.http.HttpServletResponse;

@Slf4j
public class ResponseUtils {


    public static void response(HttpServletResponse response, Object data) {

        try {
            response.setStatus(HttpStatus.OK.value());
            response.setContentType("application/json");
            response.setCharacterEncoding("UTF-8");
            response.getWriter().println(JSONObject.toJSONString(data));
        } catch (Exception e) {
            log.error("error is {} ", e.getMessage(), e);
        }

    }


}
